package edu.shu.springmybatis.controller;

import edu.shu.springmybatis.beans.Account;
import edu.shu.springmybatis.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/test")
public class AccountController {

    @Autowired
    AccountService accountService;

    @RequestMapping("/find")
    @ResponseBody
    public List<Account> find(Account account)
    {
        List<Account> byId = accountService.findById(account);
        return byId;
    }

    @RequestMapping("/insert")
    @ResponseBody
    public String insert(Account account)
    {
        accountService.insert(account);
        return "转账成功";
    }
}
